package com.senseuni.da.ui.views;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.senseuni.da.R;

import org.w3c.dom.Text;

public class NotificationView2 extends FrameLayout {

    private TextView mTitleView;
    private TextView mSummaryView;

    public NotificationView2(@NonNull Context context) {
        super(context);
        initView(context);
    }

    public NotificationView2(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public NotificationView2(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    public NotificationView2(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        initView(context);
    }

    private void initView(Context context) {
        View rootView = inflate(context, R.layout.layout_notification_view, null);
        mTitleView = rootView.findViewById(R.id.tv_title);
        mSummaryView = rootView.findViewById(R.id.tv_summary);
        ImageView closeView = rootView.findViewById(R.id.iv_close);
        closeView.setOnClickListener(v -> hide());
        addView(rootView);
//        setBackgroundResource();
    }

    public void setTitle(String title) {
        mTitleView.setText(title);
    }

    public void setSummary(String summary) {
        mSummaryView.setText(summary);
    }

    public void show() {
        setVisibility(VISIBLE);
    }

    public void hide() {
        setVisibility(GONE);
    }
}
